export const resolveComponent = (url) => { // 路由懒加载
    return () => import(`@/views/modules${url}`);
};

export const resolveRoutes = (routes) => {
    return routes.map(route => {
        // eslint-disable-next-line no-unused-vars
        const {url, path, children, component, ...rest} = route;
        return {
            path: url,
            component: resolveComponent(path || url),
            children: Array.isArray(children) ? resolveRoutes(children) : undefined,
            meta: rest,
        };
    });
};
